﻿using RTW.OA.Areas.System.Servers;
using RTW.OA.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace RTW.OA
{
    public static class ViewPageHelper
    {
        public static IList<actionpermission> GetPagePermissions(this HtmlHelper helper, string menuId)
        {
            SysMenuServers sysMenuServers = new SysMenuServers();
            return sysMenuServers.GetPermissions(menuId);
        }

        public static bool HasPermission(this IList<actionpermission> permissions, string code,int type = 3)
        {
            return permissions.Any(a => a.TYPE == type && a.PERMISSION_CODE == code);
        }
    }
}